<%-- 
    Document   : room_booking
    Created on : Nov 9, 2012, 5:02:14 AM
    Author     : sony
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Book Room</title>
        <script type="text/javascript">
            function validate_date(){
                var arr=new Date();
                    arr=document.getElementById('ardate').value;
                var dep=new Date();
                dep=document.getElementById('dedate').value;
                if(dep<arr){
                    alert("Arrival Date should be less than Departure date.");    
                    response.sendRedirect("room_booking.jsp");
                    
                }
            }
         </script>
    </head>
    <body>
        <form action="CheckAvailability">
        <table border="1">
            <%
                if(request.getAttribute("dateError")!=null){
                    out.println("<tr><td colspan='2'>" + request.getAttribute("dateError") + "</td></tr>");
                }
            %>
            
            <tr> 
                <td>Arrival Date:<input type="date" name="ardate"/></td>
                <td>Departure Date:<input type="date" name="dedate"/></td>
            </tr>
            <tr>
                <td style="text-align: center" colspan="2"><input type="Submit" value="Check Availability"  onclick="validate_date()"/></td>
            </tr>
        </table>
            </form>
    </body>
</html>
